package com.zcb.agrimarket.mapper;

import com.zcb.agrimarket.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zcb
 * @since 2024-04-03
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from user where account = #{account} and password = #{password}")
    User selectByaccount(String account,String password);


    @Select("select * from user where account = #{account} and email = #{mailbox}")
    User selectBymailbox(String account,String mailbox);

    @Update("update user set password=#{password} where account = #{account}")
    Boolean updatePassword(String account,String password);

    @Update("update user set is_deleted=1 where id = #{id}")
    Boolean deleteByMyid(Long id);
}
